<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>JSDoc: Class: makeDRS</title>

    <script src="scripts/prettify/prettify.js"> </script>
    <script src="scripts/prettify/lang-css.js"> </script>
    <!--[if lt IE 9]>
      <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->
    <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
    <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>

<body>

<div id="main">

    <h1 class="page-title">Class: makeDRS</h1>

    




<section>

<header>
    
        <h2>
            <span class="ancestors"><a href="core.html">core</a><a href="core.util.html">.util</a><a href="core.util.DRS.html">.DRS</a>.</span>makeDRS</h2>
        
            <div class="class-description"><p>Adds Drag Resize &amp; Snap to any element.</p></div>
        
    
</header>

<article>
    <div class="container-overview">
    
        

    
    <h2>Constructor</h2>
    

    <h4 class="name" id="makeDRS"><span class="type-signature"></span>new makeDRS<span class="signature">(pane, handle, options)</span><span class="type-signature"> &rarr; {object}</span></h4>

    











    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>pane</code></td>
            

            <td class="type">
            
                
<span class="param-type">HTMLElement</span>


            
            </td>

            

            

            <td class="description last"><p>The element to add drag, resize, snap.</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>handle</code></td>
            

            <td class="type">
            
                
<span class="param-type">HTMLElement</span>
|

<span class="param-type">object</span>
|

<span class="param-type">string</span>
|

<span class="param-type">Array</span>


            
            </td>

            

            

            <td class="description last"><p>A single handle or Array of handles.
                                         HTMLElement :Any HTMLElement to use and a drag handle.  Any elements
                                                      with class &quot;drag-area&quot; will be added automatically.
                                         String: Such as &quot;top&quot; see getHandleCoords() for more presets.
                                         Object: An object representing the bounds of the handle.</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>options</code></td>
            

            <td class="type">
            
                
<span class="param-type">object</span>


            
            </td>

            

            

            <td class="description last"><p>An object specifying available options.</p>
                <h6>Properties</h6>
                

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>snapEdge</code></td>
            

            <td class="type">
            
                
<span class="param-type">number</span>


            
            </td>

            

            

            <td class="description last"><p>(5) qty pixels pane edge needs to be beyond window to snap.</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>snapFull</code></td>
            

            <td class="type">
            
                
<span class="param-type">number</span>


            
            </td>

            

            

            <td class="description last"><p>(100) qty pixels pane edge needs to be beyond window to snap full screen.</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>resizeOuterM</code></td>
            

            <td class="type">
            
                
<span class="param-type">number</span>


            
            </td>

            

            

            <td class="description last"><p>(5) qty pixels outside pane bounds is dragable.</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>resizeInnerM</code></td>
            

            <td class="type">
            
                
<span class="param-type">number</span>


            
            </td>

            

            

            <td class="description last"><p>(8) qty pixels inside pane bounds is dragable.</p></td>
        </tr>

    
    </tbody>
</table>

            </td>
        </tr>

    
    </tbody>
</table>






<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="drs.js.html">drs.js</a>, <a href="drs.js.html#line94">line 94</a>
    </li></ul></dd>
    

    

    

    
</dl>













<h5>Returns:</h5>

        
<div class="param-desc">
    <p>DRS</p>
</div>



<dl>
    <dt>
        Type
    </dt>
    <dd>
        
<span class="param-type">object</span>


    </dd>
</dl>

    


    <h5>Examples</h5>
    
        <p class="code-caption">Basic usage:</p>
    
    <pre class="prettyprint"><code>var pane = document.getElementById('pane')
var drs = core.util.DRS.makeDRS(pane)</code></pre>

        <p class="code-caption">Advanced usage:</p>
    
    <pre class="prettyprint"><code>// Get an Create an element to drag, resize, and snap
var pane = document.getElementById('pane')

// (optional) Create an HTMLElement to use as a drag handle.
// NOTE: Any child element of pane with class 'drag-area' will be added automatically.
var handleOne = document.getElementById('some-id')

// (optional) create a drag handle by absolutely positioned css rules (bounds).
// Supply 4 sides or three sides and width or height to make four bounds.
var handleTwo = {
	left:0, 			// style.left
	bottom:28, 			// style.bottom
	top:0, 				// style.tip
	width:33, 			// style.width
	right:null, 		// style.right
	height:null, 		// style.height
	invert: false,		// (false) true: Will invert the bounding box (areas not covered are dragable)
	hide: false,   		// (false) true: Will not append and HTMLelement for the area defined
}
// Specify options
var options = {
	snapEdge: 5, 		// (5) qty pixels pane needs to be moved beyond window to snap
	snapFull: 100, 	 	// (100) qty pixels pane needs to be moved beyond window to snap full screen
	resizeOuterM: 5, 	// (5) qty pixels outside pane bounds is dragable
	resizeInnerM: 8,   // (8) qty pixels inside pane bounds is dragable
}

// Apply the drag resize snap to your element
var drs = core.util.DRS.makeDRS(pane, [handleOne , handleTwo], options)</code></pre>



    
    </div>

    

    

    

     

    

    

    
        <h3 class="subsection-title">Methods</h3>

        
            

    

    <h4 class="name" id="~center"><span class="type-signature">(inner) </span>center<span class="signature">()</span><span class="type-signature"></span></h4>

    



<div class="description">
    <p>Center the pane in the browser window</p>
</div>













<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="drs.js.html">drs.js</a>, <a href="drs.js.html#line561">line 561</a>
    </li></ul></dd>
    

    

    

    
</dl>
















        
            

    

    <h4 class="name" id="~restorePreSnap"><span class="type-signature">(inner) </span>restorePreSnap<span class="signature">()</span><span class="type-signature"></span></h4>

    



<div class="description">
    <p>Restore pre-snap size and position</p>
</div>













<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="drs.js.html">drs.js</a>, <a href="drs.js.html#line238">line 238</a>
    </li></ul></dd>
    

    

    

    
</dl>
















        
            

    

    <h4 class="name" id="~snapFullScreen"><span class="type-signature">(inner) </span>snapFullScreen<span class="signature">()</span><span class="type-signature"></span></h4>

    



<div class="description">
    <p>Toggle full screen mode</p>
</div>













<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="drs.js.html">drs.js</a>, <a href="drs.js.html#line229">line 229</a>
    </li></ul></dd>
    

    

    

    
</dl>
















        
            

    

    <h4 class="name" id="~togglePercent"><span class="type-signature">(inner) </span>togglePercent<span class="signature">(state)</span><span class="type-signature"></span></h4>

    



<div class="description">
    <p>Toggle pane size as percent of window or fixed size</p>
</div>









    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>state</code></td>
            

            <td class="type">
            
                
<span class="param-type">boolean</span>


            
            </td>

            

            

            <td class="description last"><p>true/false</p></td>
        </tr>

    
    </tbody>
</table>






<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="drs.js.html">drs.js</a>, <a href="drs.js.html#line221">line 221</a>
    </li></ul></dd>
    

    

    

    
</dl>
















        
    

    

    
</article>

</section>




</div>

<nav>
    <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="core.util.DRS.makeDRS.html">makeDRS</a></li></ul><h3>Namespaces</h3><ul><li><a href="core.html">core</a></li><li><a href="core.util.html">util</a></li><li><a href="core.util.DRS.html">DRS</a></li></ul>
</nav>

<br class="clear">

<footer>
    Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Thu Sep 08 2016 21:28:13 GMT-0400 (EDT)
</footer>

<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>